<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<link rel="stylesheet" href="css/listCommon.css" />
<link rel="stylesheet" href="css/evaluation.css" />
<link rel="stylesheet" href="css/bootstrap-3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" href="css/bootstrap-3.3.7/css/bootstrap-select.min.css" />
<link rel="stylesheet" href="css/register.css" />
<link rel="stylesheet" href="css/newListcommon.css" />
<link rel="stylesheet" href="css/maintenanceForm.css" />
<link rel="stylesheet" href="css/font-awesome-4.7.0/css/font-awesome.css" />
<style>
    .operate a{
        color:#666;
        display: inline-block;
        margin-right:15px;
        cursor: pointer;
        text-decoration: none;
    }
    .operate a i{
        display: inline-block;
        margin-right:5px;
    }
    .addNew table td, .addNew table th{
        padding:5px !important;
    }
</style>
<jsp:include page="../common/nav.jsp"></jsp:include>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="purchaseOrder">
        <div class="formTitle">基本信息</div>
        <div class="trackInfomation">
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>标题：</label>
                        <input id="title" type="text" class="form-control" placeholder="请输入标题" value="${requestScope.inquiryList.title}" disabled>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>采购类型：</label>
                        <select id="procurementType" class="form-control" disabled>
                            <option value="">请选择采购类型</option>
                            <c:forEach items="${requestScope.procurementTypeMap}" var="map">
                                <c:if test="${requestScope.inquiryList.procurementType == map.key}">
                                    <option value="${map.key}" selected>${map.value}</option>
                                </c:if>
                                <c:if test="${requestScope.inquiryList.procurementType != map.key}">
                                    <option value="${map.key}">${map.value}</option>
                                </c:if>
                            </c:forEach>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div id="introduceTitle" class="formTitle" style="display: none">采购要求</div>
        <div id="introduceDiv" class="trackInfomation" style="display: none">
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>询价类型：</label>
                        <select id="inquiryType" class="form-control" disabled>
                            <option value="">请选择询价类型</option>
                            <c:forEach items="${requestScope.inquiryTypeMap}" var="map">
                                <c:if test="${requestScope.inquiryList.inquiryType == map.key}">
                                    <option value="${map.key}" selected>${map.value}</option>
                                </c:if>
                                <c:if test="${requestScope.inquiryList.inquiryType != map.key}">
                                    <option value="${map.key}">${map.value}</option>
                                </c:if>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>报价截止日期：</label>
                        <input id="quotationClosingDate" type="datetime-local" class="form-control" value="${requestScope.inquiryList.quotationClosingDate}" disabled>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>开始交货日期：</label>
                        <input id="beginDate" type="date" class="form-control" value="${requestScope.inquiryList.beginDate}" disabled>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>结束交货日期：</label>
                        <input id="endDate" type="date" class="form-control" value="${requestScope.inquiryList.endDate}" disabled>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>交货期：</label>
                        下单后&nbsp;
                        <input id="day" type="number" class="form-control" style="width: 60%" value="${requestScope.inquiryList.day}" disabled>
                        &nbsp;天内交货至指定地点
                    </div>
                </div>
            </div>
        </div>
        <div id="supplierRequirementTitle" class="formTitle" style="display: none">供应商要求</div>
        <div id="supplierRequirementDiv" class="trackInfomation" style="display: none">
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label style="margin-right: 30px;">报价要求：</label>
                        <c:forEach items="${requestScope.quoteRequestMap}" var="map">
                            <c:if test="${fn:contains(requestScope.inquiryList.quoteRequest, map.key)}">
                                <input name="quoteRequest" type="checkbox" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${!fn:contains(requestScope.inquiryList.quoteRequest, map.key)}">
                                <input name="quoteRequest" type="checkbox" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>交易方式：</label>
                        <c:forEach items="${requestScope.tradingMannerMap}" var="map">
                            <c:if test="${requestScope.inquiryList.tradingManner == map.key}">
                                <input name="tradingManner" type="radio" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${requestScope.inquiryList.tradingManner != map.key}">
                                <input name="tradingManner" type="radio" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div id="designatedSettlementDateDiv" class="col-md-6" style="display: none">
                    <div class="form-group">
                        <span>*</span>
                        <label>指定账期结算日：</label>
                        <c:forEach items="${requestScope.designatedSettlementDateMap}" var="map">
                            <c:if test="${requestScope.inquiryList.designatedSettlementDate == map.key}">
                                <input name="designatedSettlementDate" type="radio" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${requestScope.inquiryList.designatedSettlementDate != map.key}">
                                <input name="designatedSettlementDate" type="radio" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div id="settlementDateDiv" class="col-md-6" style="display: none">
                    <div class="form-group">
                        <span>*</span>
                        <label>账期结算日：</label>
                        <c:forEach items="${requestScope.settlementDateMap}" var="map">
                            <c:if test="${requestScope.inquiryList.settlementDate == map.key}">
                                <input name="settlementDate" type="radio" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${requestScope.inquiryList.settlementDate != map.key}">
                                <input name="settlementDate" type="radio" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div id="paymentStageDiv" class="col-md-6" style="display: none">
                    <div class="form-group">
                        <span>*</span>
                        <label>阶段支付：</label>
                        <c:forEach items="${requestScope.paymentStageMap}" var="map">
                            <c:if test="${requestScope.inquiryList.paymentStage == map.key}">
                                <input name="paymentStage" type="radio" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${requestScope.inquiryList.paymentStage != map.key}">
                                <input name="paymentStage" type="radio" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>支付方式：</label>
                        <c:forEach items="${requestScope.paymentMap}" var="map">
                            <c:if test="${requestScope.inquiryList.payment == map.key}">
                                <input name="payment" type="radio" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${requestScope.inquiryList.payment != map.key}">
                                <input name="payment" type="radio" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>发票要求：</label>
                        <c:forEach items="${requestScope.invoiceRequirementsMap}" var="map">
                            <c:if test="${requestScope.inquiryList.invoiceRequirements == map.key}">
                                <input name="invoiceRequirements" type="radio" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${requestScope.inquiryList.invoiceRequirements != map.key}">
                                <input name="invoiceRequirements" type="radio" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span >*</span>
                        <label style="margin-right: 30px;">证照要求：</label>
                        <c:forEach items="${requestScope.certificationRequirementsMap}" var="map">
                            <c:if test="${fn:contains(requestScope.inquiryList.certificationRequirements, map.key)}">
                                <input name="certificationRequirements" type="checkbox" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${!fn:contains(requestScope.inquiryList.certificationRequirements, map.key)}">
                                <input name="certificationRequirements" type="checkbox" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">
                        <span >&nbsp;&nbsp;</span>
                        <label class="fuyanText">补充说明：</label>
                        <textarea id="remark" class="form-control fuyan" rows="3" placeholder="请输入补充说明" disabled>${requestScope.inquiryList.remark}</textarea>
                    </div>
                </div>
            </div>
        </div>
        <div id="secrecyTitle" class="formTitle" style="display: none">询价方式及隐私设置</div>
        <div id="secrecyDiv" class="trackInfomation" style="display: none">
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>询价方式：</label>
                        <c:forEach items="${requestScope.bookBuildingMap}" var="map">
                            <c:if test="${fn:contains(requestScope.inquiryList.bookBuilding, map.key)}">
                                <input name="bookBuilding" type="radio" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${!fn:contains(requestScope.inquiryList.bookBuilding, map.key)}">
                                <input name="bookBuilding" type="radio" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>采购门户：</label>
                        <c:forEach items="${requestScope.procurementPortalMap}" var="map">
                            <c:if test="${fn:contains(requestScope.inquiryList.procurementPortal, map.key)}">
                                <input name="procurementPortal" type="radio" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${!fn:contains(requestScope.inquiryList.procurementPortal, map.key)}">
                                <input name="procurementPortal" type="radio" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>比价方式：</label>
                        <c:forEach items="${requestScope.priceComparisonWayMap}" var="map">
                            <c:if test="${fn:contains(requestScope.inquiryList.priceComparisonWay, map.key)}">
                                <input name="priceComparisonWay" type="radio" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${!fn:contains(requestScope.inquiryList.priceComparisonWay, map.key)}">
                                <input name="priceComparisonWay" type="radio" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>联系方式：</label>
                        <c:forEach items="${requestScope.contactWayMap}" var="map">
                            <c:if test="${fn:contains(requestScope.inquiryList.contactWay, map.key)}">
                                <input name="contactWay" type="radio" style="width: 4%" value="${map.key}" checked disabled />${map.value}
                            </c:if>
                            <c:if test="${!fn:contains(requestScope.inquiryList.contactWay, map.key)}">
                                <input name="contactWay" type="radio" style="width: 4%" value="${map.key}" disabled />${map.value}
                            </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>联系人：</label>
                        <input id="contacts" type="text" class="form-control" placeholder="请输入联系人" value="${requestScope.inquiryList.contacts}" disabled >
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <span>*</span>
                        <label>联系电话：</label>
                        <input id="phone" type="text" class="form-control" placeholder="请输入联系电话" value="${requestScope.inquiryList.phone}" disabled >
                    </div>
                </div>
                <div id="addressDiv" class="col-md-12" style="display: none">
                    <div class="form-group">
                        <span >&nbsp;&nbsp;</span>
                        <label class="fuyanText">收货地址：</label>
                        <textarea id="address" class="form-control fuyan" rows="3" placeholder="请输入收货地址">${requestScope.purchasingRequisition.address}</textarea>
                    </div>
                </div>
            </div>
        </div>
        <div id="supplierTitle" class="formTitle" style="display: none">
            供应商信息
        </div>
        <div id="supplierDiv" class="tableWrap" style="display: none">
            <table class="table table-bordered">
                <thead id="supplierBody">
                <tr>
                    <th width="5%">序号</th>
                    <th>所属公司</th>
                    <th>供应商名称</th>
                    <th>供应商类型</th>
                    <th>供应商电话</th>
                    <th>供应商地址</th>
                    <th>注册资本</th>
                    <th>最低报价数</th>
                    <th>报价金额</th>
                </tr>
                <c:if test="${empty requestScope.inquiryList.supplierList}">
                    <tr id="supplierNothing">
                        <td colspan="9" style="color: #bbbbbb">无供应商信息</td>
                    </tr>
                </c:if>
                <c:if test="${not empty requestScope.inquiryList.supplierList}">
                    <c:forEach items="${requestScope.inquiryList.supplierList}" var="sub" varStatus="index">
                        <tr id="${"supplierLine".concat(index.count)}">
                            <td id="${"supplierNo".concat(index.count)}">${index.count}</td>
                            <td id="${"supplierId".concat(index.count)}" style="display: none">${sub.supplierId}</td>
                            <td id="${"supplierCompany".concat(index.count)}">${sub.company}</td>
                            <td id="${"supplierName".concat(index.count)}">${sub.name}</td>
                            <td id="${"supplierType".concat(index.count)}">${sub.type}</td>
                            <td id="${"supplierTel".concat(index.count)}">${sub.tel}</td>
                            <td id="${"supplierAddress".concat(index.count)}">${sub.address}</td>
                            <td id="${"supplierRegisteCapital".concat(index.count)}">${sub.registeCapital}</td>
                            <td id="${"supplierMinNum".concat(index.count)}">${sub.minNum}</td>
                            <td id="${"supplierBidAmount".concat(index.count)}">${sub.bidAmount}</td>
                        </tr>
                    </c:forEach>
                </c:if>
                </thead>
            </table>
        </div>
        <div class="formTitle">
            物资信息
        </div>
        <div class="tableWrap">
            <table class="table table-bordered">
                <thead id="materialBody">
                <tr>
                    <th width="5%">序号</th>
                    <th>供应商</th>
                    <th>总价</th>
                    <th>单价</th>
                    <th>采购方式</th>
                    <th>物料编码</th>
                    <th>品牌</th>
                    <th>物资名称</th>
                    <th>物类科目</th>
                    <th>型号</th>
                    <th>单位</th>
                    <th>数量</th>
                </tr>
                <c:if test="${empty requestScope.inquiryList.materialList}">
                    <tr id="materialNothing">
                        <td colspan="12" style="color: #bbbbbb">无物资信息</td>
                    </tr>
                </c:if>
                <c:if test="${not empty requestScope.inquiryList.materialList}">
                    <c:forEach items="${requestScope.inquiryList.materialList}" var="sub" varStatus="index">
                        <tr id="${"materialLine".concat(index.count)}">
                            <td id="${"materialNo".concat(index.count)}">${index.count}</td>
                            <td id="${"materialId".concat(index.count)}" style="display: none">${sub.materialId}</td>
                            <c:forEach items="${requestScope.inquiryList.supplierList}" var="s" varStatus="sIndex">
                                <c:if test="${s.supplierId eq sub.supplierId}">
                                    <td id="${"supplierId".concat(index.count)}">${s.name}</td>
                                </c:if>
                            </c:forEach>
                            <td id="${"totalPrice".concat(index.count)}">${sub.totalPrice}</td>
                            <td id="${"price".concat(index.count)}">${sub.price}</td>
                            <td id="${"lineType".concat(index.count)}">${requestScope.procurementMethodMap[sub.lineType]}</td>
                            <td id="${"materialCode".concat(index.count)}">${sub.materialCode}</td>
                            <td id="${"materialBrand".concat(index.count)}">${sub.materialBrand}</td>
                            <td id="${"materialName".concat(index.count)}">${sub.materialName}</td>
                            <td id="${"materialType".concat(index.count)}">${sub.materialType}</td>
                            <td id="${"materialModelNumberText".concat(index.count)}">${sub.materialModel}</td>
                            <td id="${"materialUnit".concat(index.count)}">${sub.materialUnit}</td>
                            <td id="${"materialNumber".concat(index.count)}">${sub.materialNumber}</td>
                        </tr>
                    </c:forEach>
                </c:if>
                </thead>
            </table>
        </div>
        <div class="formTitle">历史审批记录</div>
        <div class="tableWrap">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>操作人</th>
                    <th>所属公司</th>
                    <th>部门</th>
                    <th>结果</th>
                    <th>审批意见</th>
                    <th>操作时间</th>
                </tr>
                </thead>
                <c:if test="${empty requestScope.taskInfoList}">
                    <tr id="nothing">
                        <td colspan="7" style="color: #bbbbbb">无审批信息</td>
                    </tr>
                </c:if>
                <c:if test="${not empty requestScope.taskInfoList}">
                    <c:forEach items="${requestScope.taskInfoList}" var="taskInfo" varStatus="index">
                        <tr >
                            <td>${index.count}</td>
                            <td>${taskInfo.staff_name}</td>
                            <td>${taskInfo.company_name}</td>
                            <td>${taskInfo.department_name}</td>
                            <c:if test="${taskInfo.status=='0'}">
                                <td>驳回</td>
                            </c:if>
                            <c:if test="${taskInfo.status=='1'}">
                                <td>同意</td>
                            </c:if>
                            <td>${taskInfo.proc_contents}</td>
                            <td>${taskInfo.proc_time}</td>
                        </tr>
                    </c:forEach>
                </c:if>
            </table>
        </div>
        <div class="trackSubmit">
            <button type="button" onclick="window.location.href='web/inquiryList/getPageList'">返回</button>
        </div>
    </div>
</div>
<div id="headModal"></div>
<script src="css/bootstrap-3.3.7/js/jquery-2.1.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="css/bootstrap-3.3.7/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
<script src="css/bootstrap-3.3.7/js/bootstrap-select.min.js" type="text/javascript" charset="utf-8"></script>
<script>
    $(function(){
        <c:if test="${requestScope.inquiryList.procurementType eq '0'}">
            $('#introduceTitle').attr("style","display:none;");
            $('#introduceDiv').attr("style","display:none;");
            $('#supplierRequirementTitle').attr("style","display:none;");
            $('#supplierRequirementDiv').attr("style","display:none;");
            $('#secrecyTitle').attr("style","display:none;");
            $('#secrecyDiv').attr("style","display:none;");
            $('#supplierTitle').attr("style","display:block;");
            $('#supplierDiv').attr("style","display:block;");
        </c:if>
        <c:if test="${requestScope.inquiryList.procurementType eq '1'}">
            $('#introduceTitle').attr("style","display:block;");
            $('#introduceDiv').attr("style","display:block;");
            $('#supplierRequirementTitle').attr("style","display:block;");
            $('#supplierRequirementDiv').attr("style","display:block;");
            $('#secrecyTitle').attr("style","display:block;");
            $('#secrecyDiv').attr("style","display:block;");
            $('#supplierTitle').attr("style","display:none;");
            $('#supplierDiv').attr("style","display:none;");
        </c:if>
        <c:if test="${requestScope.inquiryList.inquiryType eq '0'}">
            $('#addressDiv').attr("style","display:block;");
            $('#supplierDiv').attr("style","display:none;");
            $('#supplierTitle').attr("style","display:none;");
        </c:if>
        <c:if test="${requestScope.inquiryList.inquiryType eq '1'}">
            $('#addressDiv').attr("style","display:none;");
            $('#supplierDiv').attr("style","display:block;");
            $('#supplierTitle').attr("style","display:block;");
        </c:if>
        <c:if test="${requestScope.inquiryList.tradingManner eq '0'}">
            $('#designatedSettlementDateDiv').attr("style","display:block;");
            <c:if test="${requestScope.inquiryList.designatedSettlementDate eq '0'}">
                $('#settlementDateDiv').attr("style","display:block;");
            </c:if>
            <c:if test="${requestScope.inquiryList.designatedSettlementDate eq '1'}">
                $('#settlementDateDiv').attr("style","display:none;");
            </c:if>
        </c:if>
        <c:if test="${requestScope.inquiryList.tradingManner eq '1'}">
            $('#designatedSettlementDateDiv').attr("style","display:none;");
            $('#settlementDateDiv').attr("style","display:none;");
            $('#paymentStageDiv').attr("style","display:block;");
        </c:if>
    });
</script>